This study investigated the mesophilic and thermophilic anaerobic fermentation of rape straw with biochar addition. The effects of biochar on the biogas yield, degradation of lignocellulose, bacterial community, and crystallinity were explored. The results showed that the biogas yield and methane content increased as the biochar concentration was increased. The biochar concentration of 5.0% resulted in a high biogas yield in mesophilic and thermophilic anaerobic digestion at 142.2 mL/g and 193.5 mL/g, respectively, which were 40.5% and 21.0% improvements compared with the control. The corresponding methane contents were 59.4% and 57.0%, respectively. For the lignocellulose degradation, the cellulose content in the mesophilic AD decreased from 54.0% in the pretreated rape straw to between 18.7% and 25.0%. The microbial community results showed that as the biochar concentration was increased, the relative abundance of Firmicutes initially increased before it decreased. Among the microbial community results, the relative abundances of Firmicutes and Bacteroides in the biogas residue of the mesophilic anaerobic digestion were the highest in the biogas residue with the 5.0% biochar concentration sample in the mesophilic AD, at 27.06% and 39.20%, respectively. This result revealed the mechanism of biochar to improve the biogas production of rape straw in anaerobic fermentation.