On the Dynamical Theory of Gratings