When cooking with cheese, there's nothing much worse than choosing the wrong cheese for the wrong application. Mozzarella's not great as a finisher atop pasta in the same way that parmesan is, for example, because it becomes clumpy and stringy, while a harder cheese like parmesan can become a more cohesive element of the dish. Understanding why cheeses melt in different manners can help keep your fontina on your paninis and your fetas in your salads.
When you melt cheese, you're essentially softening the milk proteins and fats to varying degrees of pliability and usability. When a cheese is heated, the protein matrix — which trapped the fats and proteins in milk and helped form solid curd when the cheese was made — collapses, encouraging the flow of cheese into a more liquid form.
The way a cheese melts is determined by its moisture content: low-moisture, and therefore normally drier, crumbly, harder cheeses, call for higher temperatures because they have such a concentrated formation of protein bonds that are harder to break down. When they melt, they don't flow in the same way that softer, more pliable, higher-moisture cheese does, which melts at lower temperatures and whose protein bonds collapse more easily.
Furthermore, a cheese that melts more easily, like a higher-moisture cheese, will then melt more cohesively with itself, while a really hard cheese like parmesan will melt as individual shavings, but won't become a melted mass like a semi-hard gruyere or cheddar. Ever heard of a grilled cheese made with a dry, aged pecorino? Probably not.
Stringiness is largely determined by how aged a cheese is as well. A well-established colony of casein (cheese protein) molecules, aged and hardened by the activity of ripening enzymes, is less able to morph into a melted, stringy form. High moisture helps to separate casein molecules, so stringier, more meltable cheeses will often be higher in moisture, but not so high like a mozzarella, that they stick together.
The best melters in the world are a great combination of both age and moisture: Emmenthaler, Gruyere, and Comte, the legendary mountain cheeses and the originators of fondue: the ultimate showcase of how choosing the right cheese for the right application pays off.
Thanks to On Food and Cooking, by Harold McGee, for reference.
Related: In Praise of American Cheese