Spectrum discretization of Smith–Purcell radiation for efficient multicolor terahertz emission