The measure, attached to an essential military-spending bill, broadens the definition of federal hate crimes to include those committed because of a victim’s gender or gender identity, or sexual orientation. It gives victims the same federal safeguards already afforded to people who are victims of violent crimes because of their race, color, religion or national origin.