We present the theory of the diffraction of electromagnetic waves by generalized spacetime periodic diffraction gratings. It is shown that such gratings produce spatial and temporal diffraction orders, yielding a quite unique diffraction pattern, not seen in conventional spatially periodic diffraction gratings. We show that in contrast with conventional static gratings, spacetime periodic diffraction gratings generate both spatial and temporal diffraction orders, where each spatial diffraction order is formed by an infinite set of temporal diffraction orders. Such dynamic gratings offer enhanced functionalities and unique characteristics, e.g., an asymmetric diffraction pattern, nonreciprocal transmissive and reflective diffraction, and enhanced diffraction efficiency. In addition, the theoretical analysis of the structure is supported by time and frequency domain FDTD numerical simulation results.