A google search yielded lots of answers. It appears fire retardant chemicals change the combustion behaviour of materials in two basic ways. The first method causes gases to be released near or at the combustion point of the material that compete with oxygen and so prevent the material from burning. The second method modifies the way the substance burns by making the material more likely to form char, rather than to flash into flame.
Further Studies on Fire Retardant Polystyrene by Friedel-Crafts Chemistry. Wang, Z.; Jiang, D. D.; Wilkie, C. A.; Gilman, J. W.
Polymer Degradation and Stability, Vol. 66, 373-378, 1999.
The combination of a copolymer of 4-vinylbenzyl alcohol and styrene with 2-ethylhexyldiphenylphosphate (DPP) and with metal chlorides has been studied by TGA, radiative gasification. Cone calorimetry, and oxygen index measurements. Evidence is presented in support of a cross-linking reaction with the additives and the copolymer which proceeds through a Friedel-Crafts mechanism. This approach reduces the peak heat release rate (HRR) by 60% as measured in the Cone Calorimeter. There is a significant reduction in the mass loss rate during the thermal degradation and evidence of char formation is observed in the radiative gasification experiments.