What wildmane said about engine braking is true for the most part. When engine braking, the fuel injectors are off completely in almost all modern cars, and most standalone ECUs offer this functionality. However, before going completely lean factory ECUs (and most good standalones) dump fuel for a split second (which can cause the backfires). This is called deceleration enrichment and it prevents the car from jerking you forward in your seat when you let off the throttle. It provides a smooth transition from engine operation to engine shutdown.
If a car is backfiring excessively during engine braking it is typically a sign of a poorly tuned car. For one reason or another the ECU isn't cutting fuel completely during breaking. It can be a TPS problem, or someone who forgot to turn the "overrun fuel cut" on in their standalone settings, etc.