This is an awkward question to answer. Diesel engines run much higher compression ratios than petrol engines and they run a lot hotter, so the oil is formulated to deal with this. Plus, they produce a lot more dirt in terms of combustion by-products. Diesel-rated oils typically have more detergents in them to deal with this. It's not unheard of for diesel oils to clean a petrol engine so well that it loses compression. Diesel-rated oils also have an anti-foaming agent in them which is unique to diesel engines, and not needed in petrol engines.
So is that the be-all and end-all answer? Well, not really and that's why this is a difficult question to give a straight answer to. The above statement is more relevant to commercial diesel engines. Nowadays, just about all passenger car / light commercial oils (including OEM ones designed for both petrol and diesel engines) will carry the ACEA A and B specifications (i.e. formulated to satisfy the requirements for both types of engines.) So just because the oil is labeled "diesel" doesn't mean it's not suitable for petrol engines it will more than likely carry an ACEA A3 / OEM petrol spec as well.
However, you do need to be a bit careful regarding choosing the right diesel spec. If you have a modern common rail / direct injection diesel, chances are it will require at least an ACEA B4 spec to cope with the higher piston temperatures that can cause piston deposits (and stuck rings). ACEA B4 is fine where B3 is recommended.
Edgewood Auto Parts #253