You should never modify the gradient passed to the hook!
But the hook can return a Tensor that will be use instead of the current gradient.
So the hook can be used to replace the gradient that will flow back a given branch.