The Supreme Court has ruled that women are defined by biology in a landmark judgment which deals a blow to transgender campaigners.