According to the U.S. Code, Title 4, Sec. 9, "During the ceremony of hoisting or lowering the flag or when the flag is passing in a parade or in review, all persons present in uniform should render the military salute. Members of the Armed Forces and veterans who are present but not in uniform may render the military salute. All other persons present should face the flag and stand at attention with their right hand over the heart, or if applicable, remove their headdress with their right hand and hold it at the left shoulder, the hand being over the heart. Citizens of other countries present should stand at attention. All such conduct toward the flag in a moving column should be rendered at the moment the flag passes."
This section does not specifically address the actions of people in uniform other than those in the military. Nonetheless, it may be inferred that members of patriotic, uniform-wearing organizations, such as veterans groups and Boy and Girl Scout troops, may follow the standard for members of the military, leaving their headdress on and rendering their organization's salute.
When, on U.S. soil, the national anthem of more than one nation is played, the visitors’ national anthems are played first, and may or may not be followed by our National Anthem. During the visitors’ anthems, all present should stand at attention and face the flags of the nations (or the music, if they are not present). Men not in uniform should remove their hats as well.
We contacted the Institute of Heraldry (Army) regarding the rendering of a salute during anthems of other nations. They did not have an official answer to this question but commented that they felt it would be appropriate for U.S. citizens to salute only during the playing of our National Anthem. We concur with that recommendation.