An analysis of resonances of scattering from multi-element grating formed by a finite number of resonant elements is presented. It has been shown that gratings with three and more elements on its period can support the π-mode. The π-mode of a grating is characterized by the existence of the regions in the vicinity of the grating and along its period where the electromagnetic field has opposite phases. The existence and excitation of the π-mode in finite gratings with resonant cells formed by several scatterers having open cavities have been studied. The particular case of the grating with cells formed by three identical slotted cylinders has been considered in detail. An application of gratings which support the π-mode in electron-vacuum oscillators of millimeter waves for efficient deceleration of electrons and extracting energy from electron beam is discussed.