Background: Recently, the popularity of dual-layer flat-panel detector (DL-FPD) based dual-energy cone-beam CT (DE-CBCT) imaging has been increasing. However, the image quality of DE-CBCT remains constrained by the Compton scattered X-ray photons. Purpose: The objective of this study is to develop an energy-modulated scatter correction method for DL-FPD based CBCT imaging. Methods: The DLFPD can measure primary and Compton scattered X-ray photons having dfferent energies: X-ray photons with lower energies are predominantly captured by the top detector layer, while X-ray photons with higher energies are primarily collected by the bottom detector layer. Afterwards, the scattered X-ray signals acquired on both detector layers can be analytically retrieved via a simple model along with several pre-calibrated parameters. Both Monte Carlo simulations and phantom experiments are performed to verify this energy-modulated scatter correction method utilizing DL-FPD. Results: Results demonstrate that the proposed energy-modulated scatter correction method can signficantly reduce the shading artifacts of both low-energy and high-energy CBCT images acquired from DL-FPD. On average, the image non-uniformity is reduce by over 77% in the low-energy CBCT image and by over 66% in the high-energy CBCT image. Moreover, the accuracy of the decomposed multi-material results is also substantially improved. Conclusion: In the future, Compton scattered X-ray signals can be easily corrected for CBCT systems using DL-FPDs.