You can enable locking to a typographical baseline grid, to a page baseline grid, or to both grids.
If your page design requires locking to grid, it is recommended to enable always locking to both grids.
Locking to the typographical baseline grid is explained in Typographical baseline grid, in particular in Typographical baseline grid on format level, Typographical baseline grid on styles level, Enable/disable typographical baseline grid and Disable typographical baseline grid for certain body styles.
Locking to the page baseline grid is explained in Page baseline grid.
If locking to a page baseline grid seem not to work at all, or it works incorrectly
See Troubleshooting and FAQ for baseline grid.