This paper presents a shunt active power filter (SAPF) for compensating inter-harmonics and harmonics when inter-harmonics content is evident in the grid. The principle of inter-harmonics generation in the grid was analyzed, and the inter-harmonics effect on repetitive controllers was discussed in terms of control performance. Traditional repetitive controllers are not applicable in inter-harmonic compensation. Moreover, the effect of an ideal controller on harmonics signals was analyzed on the basis of the internal model principle. The repetitive controller was improved in the form of a basis function according to theoretical analysis. The finite-dimensional repetitive controller, which is also called the multiple-period repetitive controller, was designed for the control of multiple periodic signals. A selective harmonic compensation system was developed with SAPF. This system can be used to compensate harmonics and inter-harmonics in the grid. Finally, system control performance was verified by simulation and experimental results.