The UK Supreme Court has ruled that the legal definition of a woman should be based on biological sex.