When you smash a burger, you give it more surface area to cook. That causes The Maillard Effect, which is basically a chemical reactions that happens when proteins are heated, causing them to brown. This is different from the browning (aka caramelization) that happens when sugar is heated. For more details, read this post about the Maillard reaction, which will explain it a lot better than I can.