You can toggle the grid background on and off by selecting or deselecting Display > Grid or by clicking .
You can snap your nodes to the grid by selecting Display > Grid Snapping or by clicking .
You can toggle the grid snapping state by pressing x. For example, if grid snapping is disabled, you can temporarily enable it by pressing x while working with your nodes. Grid snapping is disabled again as soon as you release the x key.
You can customize the colors for the grid and background colors by navigating to Windows > Settings/Preferences > Color Settings. Under the General tab, expand the Node Editor section, and click on the color swatch beside Grid and Background to select a color using the Color Chooser.