Obviously its just to incense the Muslim minority and usually for political gain. But the thing is reacting by rioting is playing right into the hands of these people. You're absolutely right, these people who burn Qur'ans are cunts. But the best thing that can be done in reaction to this is...nothing! Because without the big Muslim anti-protest/riot, these political stunts would just be a sad, lonely gathering by fringe political losers and rabble-rousers. Attacking them or rioting in response is the one that would engender any kind of sympathy for them and their cause.
Of course what is taken for granted by the advocates of these losers is the idea that Europe has freedom of speech in the same way the US does which is just not true as
@Ruprecht hints at. Lots of these countries have anti-flag burning laws for instance. Sweden doesn't but like other Euro countries that don't they will often prosecute flag burners under some other pretense. But France, which views itself at the vanguard of the fight for free speech(i.e. right to insult Muslims), does have strict laws against flag burning. In fact one is not even allowed to distribute images of flag desecration in private and disrespecting the national anthem during public events is also banned. So its always a bit rich to see Euros get on their high horse about freedom of speech.