It does not mean that we set the gradient of b to zero.
param.grad[:, 1:10, :, :] = 0

This line indicates that we just ignore the calculated gradient w.r.t loss so that the parameters are not updated.
You do not have to worry about your example because all gradients are calculated with backward() call.
We modify the gradient after the backward(), so other parameters are safe.