Grazing behavior is a key factor that affects the sustainable development of the grassland social-ecological system. Grazing behavior is not only restricted by policies but also affected by the awareness of the herder of the grassland environment. To explore the influencing factors and mechanism behind grazing behavior, Yanchi County of Ningxia, a typical area of the “returning grazing land to grassland” project in Northwest China, was selected as a study area. Based on the consciousness-context-behavior theory, a questionnaire was designed, and 305 households were surveyed. Analysis of structural equation model results show: (1) the environmental sensitivity of herders and their satisfaction with the compensation mechanism regulated grazing behavior. When herders were more dependent on grassland, they were more willing to graze. (2) The grassland dependence, environmental sensitivity of herders, and herders’ satisfaction with the compensation mechanism had a significant interaction effect on grazing behavior. (3) Family livelihood diversification and the number of young and middle-aged laborers had a significant moderating effect on grassland dependence and grazing behavior. These findings are of vital importance for the government to formulate policies to promote the sustainable development of grasslands.