Frame challenge: wrong tool for the wrong job.
Flashbang grenades are more formally known as stun grenades. This should give you a pretty clear idea of their use: to stun, by use of a bright flash and loud noise. When being suddenly and violently blinded and deafened, you probably aren't going to run away very far, if at all. It isn't a weapon designed to disperse a crowd, it's designed to incapacitate before you run it and make an arrest.
You wouldn't use a stun grenade to "paint" a bunch of people for the simple and good reason it's not what stun grenades do. They don't fragment. They don't expel gas. They just make noise and sound. And you wouldn't use them for crowd control because it may cause non-temporary blindness or deafness, and can also set flammable material on fire. As far as I know, no riot control police unit uses stun grenades.
Tear gas grenades are better suited for crowd dispersal. They don't stun, rather they are designed to be extremely uncomfortable. They will impair vision (because tears), but they don't really incapacitate. It doesn't fragment, but it does emit a cloud of gas locally. Being a gas, it's wont to get into your eyes and lungs, so consider that if you don't want to be too harmful.
But even if tear gas is used for crowd dispersal, and you could conceivably use it to mark people, I think there is a much better alternative.
The water cannon. Water has a few advantages. It's readily available from fire hydrants. With the right amount of pressure, it's less-lethal but also not pleasurable, inciting people to disperse. Despite what you might read on the internet, dihydrogen monoxide is a non-lethal and very safe chemical. This is why it is also used in the real world.
The water alone can be used to identify people at a protest. If properly soaked, you wouldn't dry up before a few hours, so that would be a simple and decent, although easily defeated, tell.
You can mix a "colorant" with your water, preferably a non-toxic and food-safe colorant, and one that leaves a really-hard-to-clean mark. From there, you can quickly identify someone who was at the protest because they would be literally painted, and traces might remain for days or weeks. You can add a radioactive element to your paint, so the trace could remain longer. You could also use a UV or IR component so that it would be harder for the target to see if they've successfully removed it or not.
The colorant here could be a paint, or something that acts as a paint, in which case you have something similar in principle to dye packs.
It could also be a solid like glitter, and if you've experienced glitter you know it can be quite difficult to completely remove, but it's still harmless (except maybe to the eyes as a fashion choice).
Don't be afraid by the visible nature of the paint. Firstly, your system will become known after the first time you deploy it. Whether its effect is visible or not, protesters should assume they've been painted. Secondly, in the immediate aftermath, your security forces can perform the check with zero additional requirement. No blacklight, no scanner, just a pair of eyeballs.
This is all very low tech, very understandable by a reader, and even relatable. The obvious downside here is that it will also be difficult to remove when you paint the road and kerbs with it.
Here's another alternative and/or complement: Paintball. You may have played with those recreationally. You could easily tweak the paint to be harder to remove, but otherwise it's a non-lethal weapon as long as you don't aim for the head, but it's still quite painful enough to incite dispersal.
This could be used for more targeted painting, since this you can aim at specific people, for instance protest leaders. You could use a distinctively different marking so that they would be flagged differently at your security checkpoints.
While paintballs aren't used by police, similar weapons exist that throw little balls with tear gas, so it wouldn't be completely out of place.