Read the article, explains it and shows cross sections of fireworks to aid understanding.
But yes, changing the formulation also affects burn rate. For example, replacing potassium nitrate with potassium perchlorate yields a much faster burn.[0] Also replacing the carbon with aluminum dust gives you flash powder.[1]
0) https://pyrodata.com/compositions/Black-Powder-Perchlorate