The agreement could affect tens of thousands of veterans who were discharged under “don’t ask, don’t tell” and similar policies.