It's a good idea to have a function that changes the grid color and style. Mathworks hasn't implemented this function for years. The grid is implemented as a single graphical object and a handle is returned. So after generating a grid it can be modified easyly.
The axes properties 'XColor' 'YColor' 'ZColor' and 'GridLineStyle' already provide this capability. In fact with these properties you can make the grid color different along the different dimensions.
Function is poorly written. Use the basic object line(...) for drawing these kinds of lines rather than the high level plot(...) function, then you don't have to look at NextPlot properties, etc. You can then easily set HandleVisibility to 'off' to hide the new grid.