We theoretically study high-order harmonic generation (HHG) from relativistically driven overdense plasma targets with rectangularly grating-structured surfaces by femtosecond laser pulses. Our particle-in-cell (PIC) simulations show that, under the conditions of low laser intensity and plasma density, the harmonics emit principally along small angles deviating from the target surface. Further investigation of the surface electron dynamics reveals that the electron bunches are formed by the interaction between the laser field and the target surface, giving rise to the oscillation of equivalent electric-dipole (OEED), which enhances specific harmonic orders. Our work helps understand the mechanism of harmonic emissions from grating targets and the distinction from the planar harmonic scheme.