Your two equations are very different in fact: Snell's law can be derived using geometric optics, while the grating equation requires wave theory of light. The grating (as an optical instrument) was invented by Joseph von Fraunhofer in 1823, when the wave theory was already available but not universally recognized. Apparently the equation is due to him as well.
Source: S. Sternberg, A history of 19th century spectroscopy, Appendix F to his book Group Theory and Physics, Cambridge UP, 1994.
E. T. Whittaker, History of the theories of Aether and Electricity.