Ferulic acid (FA) and p-coumaric acid (pCA) in bagasse, wheat straw, corn straw, and corncob were extracted by alkaline hydrolysis and characterized by gas chromatography (GC) and gas chromatography-mass spectrometry (GC-MS). It was found that the FA and most of the pCA in gramineous biomass could be dissociated and released after being treated with 1 M NaOH at 100°C for 4 h. The yields of pCA/FA in bagasse, wheat straw, corn straw, and corncob determined by GC-FID are 39.8/11.5, 13.7/11.0, 28.0/11.0, and 35.1/14.5 mg/g, respectively. The raw materials and the treated solid residues were characterized by gel-state 2D Heteronuclear Single Quantum Coherence Nuclear Magnetic Resonance (2D HSQC NMR). It was found that only a small amount of lignin was detected in the residue after alkali treatment, indicating that the alkali treatment conditions can effectively cleave the FA and pCA. Additionally, the lignin in the alkali solution was recovered and characterized by 2D HSQC NMR. The FA was not able to be detected by NMR, whereas a small amount of pCA remained in the alkali lignin. This study reveals the structural change of residual lignins during the quantitative isolation of FA and pCA, which is essential for the selective isolation of pCA/FA and valorization of residual alkali lignin.