Marlin versions < 2.0
Marlin versions before 2.0 did not support the S param in G1-G3 moves. To get it somehow working we added a special gcode generater for Marlin, which removes the S param from such moves. Additionally you need to configure the TOOL ON = M3, TOOL OFF = M5 and activate the flag INTENSITY SEPARATE LINE.
Marlin versions >= 2.0.6
Since version 2.0.6 Marlin supports the S param in G1-G3 commands, like Grbl and Smoothieware. So the special gcode generator is not anymore needed! Use gcode generator "default" in the gcode settings.
But you must activate the folowing config option in Marlin, to switch on modal mode:
#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc.
See https://marlinfw.org/docs/configuration/2.0.9/laser_spindle.html for details on Laser/Spindle Configuration.