Thousands of veterans who were ejected from the military because of their sexual orientation or gender identity will be able to receive up to £70,000 each in compensation to correct "historic wrongs".