There are many changes that take place when food is exposed to heat, a process known more commonly as "cooking."
And it depends on the food. Proteins like meat and eggs become firm and opaque. Vegetables change color and soften. Fats liquefy. Starches swell and expand like little sponges.
Carbohydrates, the sugars found in starches and in fruits and vegetables, turn golden brown and form new flavors.
This transformation is called caramelization, and indeed it is literally the process that causes sugar to turn into caramel.
Caramelization in turn is caused by pyrolosis, which is a broad category of changes that a substance undergoes when exposed to certain temperatures.
Meat is another food that turns brown when you cook it, and this is also due to pyrolosis. But the difference is that with meat, pyrolosis causes a reaction in the amino acids in the protein (known as the Maillard reaction). Whereas with carbohydrates, pyrolosis reacts with sugars, causing caramelization.
In either proteins or starches, the effect of pyrolosis requires high temperatures. In the case of ordinary sugar (or sucrose), caramelization begins at around 320 degrees F (although fructose, which is found in fruits, vegetables and honey) caramelizes at a much lower temperature, around 230F). With the Maillard reaction, browning starts at about 310 degrees.
What this means is that caramelization can only happen in a dry-heat cooking environment.
That is because the highest temperature water can reach is 212F. Not hot enough to pyrolize sugars or proteins. Thus, you can't caramelize anything by boiling it, simmering it, poaching it or anything like that involves cooking it in liquid.
Caramelization does happen with toast, of course, and baked bread in general. Fun fact: If you ever heard that the crust of bread is more nourishing or has more vitamins in it or something, well, let's think it through. It's the same dough on the outside of the bread as on the inside.
The only difference is that the outside was exposed directly to the hot air in the oven, which caused it to caramelize and turn brown. The dough inside the loaf was only exposed to other dough, which contained liquid, and thus never achieved a high enough temperature to turn brown. And while caramelization does produce new colors and new flavors, it does not produce new vitamins or other nutrients. The more you know!
Another fun fact is that deep-frying will obviously produce golden-brown colors, even though french fries are made by immersing them in hot, liquefied fat. How can a liquid be dry? In the case of fat, it's considered dry because when you're deep-frying, the fat is hotter than the boiling point of water. Which means any water in the food (at least in the exterior part of it) gets cooked away, and then the caramelization begins. All those bubbles you see when something goes into the deep-fryer is the water in the food boiling off.
Another effect of caramelization is that it forms new flavors, including flavors you might describe as buttery, or sweet, or nutty, or toasty. Each of these flavors results from the creation of flavor compounds (i.e. chemicals) as byproducts of the pyrolization process.
As it happens, these compounds can be isolated and then added into foods. When you see something called "natural flavors" in the ingredients list, that is often what they are.