Dental plaque is essentially a layer of microorganisms in an organic polymer matrix that exists as a thin film on the teeth. This matrix consists of mucin, a type of mucopolysaccharide, dead epithelial cells, various colloidal substances contained in saliva and a number of other fairly complex molecules derived from saliva and oral glands.
The commonest dental disclosing tablet dye the teeth cherry-red and contain the substance erythrosine. This coal-tar type dye is the disodium salt of the monohydrate of 9-(o-carboxy-phenyl)-6-hydroxy-2,4,5,7-tetraiodo-3H-xanthen-3-one and is also a permitted food colourant in many countries for use in meat pastes and sausages etc.
As far as how erythrosine dyes dental plaque is concerned, what happens is that the dyestuff latches on to the polymer matrix of the plaque by covalent and ionic bonding and in effect, becomes part of the plaque. The matrix then becomes cherry-red in colour. Erythrosine does not dye the microorganisms in plaque but instead dyes the matrix they live in.
If I could just add that sometimes you'll come across a dentist who'll tell you that disclosing tablets dye or stain the bacteria. This is not strictly true but the simplification avoids the need to discuss at length with a patient exactly what plaque is made up of.