Under EU Flight Compensation Regulation 261, you are entitled to compensation if your flight is delayed by more than a certain amount of time. In 2009, the European Court of Justice ruled that this delay applies to the "loss of time" experienced by the passenger; in other words, it's calculated as a delay of the arrival time, not the departure time. A 2014 CJEU ruling clarified this further: the delay is calculated between the scheduled arrival time and the time at which the aircraft doors open at your final destination.
Thus, passengers on a flight that was diverted or returned to its departure point would be entitled to compensation, rerouting, refunding, and/or overnight accommodation. This assumes, of course, that the length of the delay met the pertinent thresholds, and that the diversion/return was not due to meteorological factors or air traffic management.