For a straight line, I generally use a table saw with an old blade. You have to maintain a firm stead grip yet be ready to run away if the saw grabs the foam, melts a bit of it to the blade and sends it flying.
For terrain, I generally use a keyhole saw and or pen knife. A steak knife can also be used. Shaping can be done with a wood rasp and or coarse sandpaper. The wood rasp can also be used to smack against the foam to make “tool marks” in masonry. A triangular file can be used to make mortar/joint lines in masonry.
And RSJB18 mentioned the most important tool: a shop vac.