The black soldier depicted in the Painting is meant to represent Major Peirson's servant "Pompey" avenging the Major's death by shooting the French sniper who had just mortally wounded him.
Whether Major Peirson actually had a black servant named Pompey, and, if he did, whether he was even at the battle, let alone shooting Frenchmen, is dubious.
The uniform which Pompey is depicted as wearing is that of Lord Dunmore's "Royal Ethiopian" regiment. The Royal Ethiopian Regiment did exist. It was raised by Lord Dunmore from escaped slaves during the American revolution to fight against the Americans. The Royal Ethiopian Regiment fought in America, and reportedly had "Liberty to Slaves" embroidered on their uniforms.
Source: http://www.johnhorse.com/trail/00/bg/20.htm
The artist was John Singleton Copley, a Massachusetts loyalist. An inspiration for his painting was the famous painting "The Death of General Wolfe" by another American artist, Benjamin West, depicting Wolfe's death at the battle of the Plains of Abraham outside the walls of Quebec in the French and Indian War. West had also inserted a spurious African American into his work of art. (Two in fact, though not nearly so prominently. See if you can spot them):
http://www.kenney-mencher.com/pic_old/18th_century/west_death_of_general_wolfe_1771.jpg
Copley was presumably inspired by that, but perhaps also by a belief that the American Revolution was hypocritical in proclaiming liberty while supporting slavery, and wishing to honor African Americans and the Royal Ethiopian Regiment in his art.
Source: http://atlanticportal.hil.unb.ca/acva/blackloyalists/en/context/gallery/copley.html
The subject of the painting was the Battle of Jersey. When French forces during the American Revolution invaded the Channel Island of Jersey, they surprised the Governor of the Island in his bed and forced him to sign a surrender. Major Peirson, the 24 year old commander of the garrison, refused to surrender and led the garrison and the Jersey militia in a counter attack against the French. He was killed earlier in the battle than at the final charge which defeated the French (which is where he is shown dying in the painting).
Even if the presence of Pompey at the battle is not attested by any contemporary sources (and if he was, he would not have been wearing the uniform of the Royal Ethiopian Regiment), there actually was a non-European at the battle.
The co-commander of the French invasion forces was Mir Sayyad, an Indian (from India, not from North America) general, serving in the French forces after having lost his lands to the British in India.