Odd rule. From ESPN F1 UK: https://www.espn.co.uk/f1/story/_/id/27081895/hamilton-gets-three-place-grid-penalty-kimi-block
There was some confusion over whether Hamilton would start fifth or fourth on the grid, with confirmation coming late in the day from F1 that it would be fourth despite Mercedes initially believing it would be fifth. The reason is because Kevin Magnussen in fifth place also has a grid penalty (of five places due to a gearbox change) and the Haas driver effectively leaves an empty space on the grid behind Hamilton. Only once all grid penalties have been applied (there are six this weekend) are the empty spaces vacated by drivers with penalties removed from the provisional grid, meaning Hamilton drops three places to fifth with his penalty and then moves up one place to take the position vacated by Magnussen.