Dislocations require proper lattice ordering to move through a material. At grain boundaries, there is a lattice mismatch, and every atom that lies on the boundary is uncoordinated. This stops dislocations that encounter the boundary from moving.