The strict maintenance of formation was a focal point of Roman military training, so when two infantry forces engaged, determining the identity of the enemy was simple: it was the unit advancing towards you. The wild melees of Hollywood are fantasy, and bear no resemblance to actually combat. That said, Roman units employed a number of identifiers that could help determine friend from foe, principally shield blazons and banners.
By Late Antiquity, Roman units could be identified by the unique blazons painted on their shields. Medieval copies of the Notitia Dignitatum preserve some of these. In theory, each man in a unit would have this unique regimental design painted on their shield, which could then easily identify comrades. On campaign, it is likely that soldiers simply painted the regimental colors onto replacement shields rather than replicating potentially intricate blazons. Thus, when a given unit assembled, the shields would not have presented as uniform an appearance as manuals like the Strategikon ascribe. Even so, shield blazon and/or color was a significant identifier.
The Roman army had a long history of using varied standards and banners, and Late Antiquity was no exception; though it is worth pointing out we know less about their design than during the Principate or the early Byzantine period. Banners offered a visual means of communicating orders, and in battle acted as a rallying point (the Strategikon advising soldiers to stick close to the standard). The regimental standard was thus placed in a central location in the line of battle, though where the regimental standard-bearer stood is debated. Doubtless he stood in the front, both for the reasons above and, as a senior under-officer, his position was with the decanii and pentarkes who, as file-leaders, stood there. Yet it is unclear if he was expected to actively participate in the fighting. Epigraphic evidence from a cavalryman identified as a standard-bearer suggests they were, though this is far from clear. Either way, standards acted as a visual identifier of regiments during battle. For a Roman soldier engaged in a Late Antique civil war, it was possible to determine an enemy from looking at the blazon of his shield or the banner under which he marched.