The answer to a question this general is always "Well that depends". It depends on where, when and who, "Europe" and "medieval" denotes a pretty big area and a pretty long and ill-defined time and "foot soldier" can be anything from a levied peasant to a dismounted knight).
So let me give a pretty general answer.
Kill whoever is facing you!
Medieval battles are generally formation fighting. You know the people to your left and right are your friends because they're to your left and right and you know the guy in front of you is your enemy because he's in front of you and probably trying to kill you.
Kill whoever is near someone you recognize as enemy!
Major heraldric patterns would have been pretty widely recognized and if you spot a knight somewhere he had a decent chance of being recognized. Based on which knights are where you can get a decent idea of where the unit is from and who it fights for. For example, "There is Edward the Black Prince, kill whoever is around him!"
Look to the banners!
Genereally there's a leader, an officer or something similar in a unit. Often he would have had a banner, either one he carried himself or carried by a soldier near him. Recognize the banner, recognize the side.
Know your heraldry!
Coats of arms are cool and while they might look confusing to us today they are actaully kind of logical. Based on a coat of arms you can often recognize nationality, regionality, family ties and rank. That's helpful in battle and even if you didn't recognize the specific noble by his coat of arms you could probably take a good guess at which side he was on based on his coat of arms. For example, a knight whose coat of arms is made up of two family patterns which are both English is more than likely fighting for the English.
Listen!
Battle cries were frequently used to tell units and sides apart. The english often used "St George!" during the 100 years war for example. The Swedish caroleans often used "Gott mit uns!" and so on. Based on which war cries you hear, you can tell which unit is which.
Colours!
A piece of coloured cloth, either around your upper arm or around your head has been used numerous times throughout european history, especially when units needed to distinguish friend from foe in situations where they might otherwise be hard to tell apart (such as in a civil war).