Refining is done by heating and cracking petrol and then sorting out the different components in a tall distillation column. Diesel is heavier than gasoline so it is overall easier to refine. There is a nice simplified figure here.
That being said, the differences are not as important as those in the engine. As EnergyNumbers pointed out in another answer, diesel is more efficient, at the cost of higher emissions. This is true especially on older engines. On modern engines, from petrol to wheel, diesel is about 20% more efficient.