Formula 1 races will be two to three laps shorter from 2027 after the FIA agreed a reduction.