In any military or quasi-military institution (eg Starfleet) the uniform and associated insignia has a particular significance because is is a very real symbol of authority. On one hand this is down to practical considerations as it is necessary for an officer or NCO to be able to assume authority regardless of whether they are known to the individuals they command or not. A large military organisation would quickly break down in a crisis if every leader had to assert themselves by force of personality in order to be able to issue orders. In fact this dynamic is a common trope especially in US centric sci-fi (see especially the leadership tensions between Galactica, Pegasus and the civil administration in the BSG reboot).
In many organisations the uniform and insignia also have specific legal status and may be fundamental to the sense of identity, loyalty and motivation of a unit. 963
this goes back at least as far as the Roman Empire where the 'Eagle' insignia of a Legion was a physical symbol of their honour an identity. Certainly in the modern British army apparently archaic symbols like Colours (regimental standards) and cap badges and berets are treated with more reverence than the actual 'uniform' (in the sens of official clothing) or even badges of rank. There is also the fact that (for UK armed forces that least) that 'commissioned' ranks and Colours have a very specific legal authority originating from 'the Crown' (ie the seat of national sovereignty) as opposed to just being administrative ranks and the same applies to sworn Police Officers.
There is also the fact that a recognizable national uniform is a key part of of the rules of war and fighting in uniform gives specific legal protection to the wearer distinguishing them from eg spies and saboteurs.
There is also a strong sense that both a uniform and (especially) badges of rank are something which need to be earned and imply the acceptance of a certain code of behaviour.
So for an obvious enemy to appear in Star-fleet uniform is a clear provocation as it is both appropriating a culturally important identity and treating it as trivial. This is emphasized by the fact that Q goes out of his way to act in a way which is the antithesis of conventional military discipline and deportment.
On a more subtle level Q is also mocking the jingoism and unthinking nationalism which Starfleet overtly rejects but is still arguably implicit in it's quasi-military discipline. 963