We have been investigating two-dimensional (2D) antiscatter grids (2D ASGs) to reduce scatter fluence and improve image quality in cone beam computed tomography (CBCT). In this work, two different aspects of 2D ASGs, their scatter rejection and correction capability, were investigated in CBCT experiments. To correct residual scatter transmitted through the 2D ASG, it was used as a scatter measurement device with a novel method: grid-based scatter sampling. Three focused 2D ASG prototypes with grid ratios of 8, 12, and 16 were developed for linac-mounted offset detector CBCT geometry. In the first phase, 2D ASGs were used as a scatter rejection device, and the effect of grid ratio on CT number accuracy and contrast-to-noise ratio (CNR) evaluated in CBCT images. In the second phase, a grid-based scatter sampling method which exploits the signal modulation characteristics of the 2D ASG's septal shadows to measure and correct residual scatter transmitted through the grid was implemented. To evaluate CT number accuracy, the percent change in CT numbers was measured by changing the phantom from head to pelvis size and configuration. When 2D ASG was used as a scatter rejection device, CT number accuracy increased and the CT number variation due to change in phantom dimensions was reduced from 23% to 2-6%. A grid ratio of 16 yielded the lowest CT number variation. All three 2D ASGs yielded improvement in CNR, up to a factor of two in pelvis-sized phantoms. When 2D ASG prototypes were used for both scatter rejection and correction, CT number variations were reduced further, to 1.3-2.6%. In comparisons with a clinical CBCT system and a high-performance radiographic ASG, 2D ASG provided higher CT number accuracy under the same imaging conditions. When 2D ASG is used solely as a scatter rejection device, substantial improvement in CT number accuracy can be achieved by increasing the grid ratio. Two-dimensional ASGs also provided significant CNR improvement even at lower grid ratios. Two-dimensional ASGs used in conjunction with the grid-based scatter sampling method provided further improvement in CT number accuracy, irrespective of the grid ratio, while preserving 2D ASGs' capacity to improve CNR. The combined effect of scatter rejection and residual scatter correction by 2D ASG may accelerate implementation of new techniques in CBCT that require high quantitative accuracy, such as radiotherapy dose calculation and dual energy CBCT.