In this paper, we propose an optimizing method for the beaming effect from a slit aperture with finite metallic grooves. Aiming at the beaming effect of the structure at 0 degrees, we analyze the effect of the parameters including groove depth, groove width and groove number of the structure on the diffraction efficiency as well as angular spectra in the far field by approximation of the boundary condition of the quasi-perfect conductor assumption and the fundamental mode. Our optimization results demonstrate that the diffraction at other angles is efficiently suppressed. Finally, we give several optimized parameters of three common wavelengths of 10.6 mu m, 808 nm and 632.8 nm, on the basis of using the optimizing method. Although we analyze the beaming effect at 0 degrees only, the method is also applicable to the analysis for other angles.