Suppose that $\varphi : \bar{B}(x,2r) \to [0,\infty)$ is Lipschitz and $\varphi =0$ on $\partial B(x,2r)$. Note that since $\varphi$ is Lipschitz, it is differentiable almost everywhere by Rademacher's theorem. Then
$$
0 \le \int_{B(x,2r)} \varphi^2 f u^2 = \int_{B(x,2r)} \varphi^2 u \Delta u = \int_{B(x,2r)} - \nabla (\varphi^2 u) \cdot \nabla u
$$
since $\varphi$ vanishes on $\partial B(x,2r)$. Since
$$
\nabla(\varphi^2 u) = 2 \varphi \nabla \varphi u + \varphi^2 \nabla u
$$
we find, upon plugging in above, that
$$
0 \le -\int_{B(x,2r)}2 \varphi u \nabla \varphi \cdot \nabla u + \varphi^2 |\nabla u|^2,
$$
and so
$$
\int_{B(x,2r)} \varphi^2 |\nabla u|^2 \le \int_{B(x,2r)} -2 \varphi u \nabla \varphi \cdot \nabla u \le 2 \left(\int_{B(x,2r)} \varphi^2 |\nabla u|^2\right)^{1/2} \left(\int_{B(x,2r)} u^2 |\nabla \varphi|^2 \right)^{1/2}.
$$
From this we then see that
$$
\int_{B(x,2r)} \varphi^2 |\nabla u|^2 \le 4 \int_{B(x,2r)} u^2 |\nabla \varphi|^2.
$$
With the last inequality in hand we can prove the result. Set
$$
\varphi(y) =
\begin{cases}
1 & \text{if } |x-y| \le r \\
2 - |x-y|/r & \text{if } r < |x-y| \le 2r.
\end{cases}
$$
It's easy to see that $\varphi \ge 0$, $\varphi$ vanishes on the boundary, and $\varphi$ is Lipschitz. Also
$$
|\nabla \varphi(y)| =
\begin{cases}
0 & \text{if } |x-y| \le r \\
1/r & \text{if } r < |x-y| \le 2r.
\end{cases}
$$
Plugging this in above then gives the inequality
$$
\int_{B(x,r)} |\nabla u|^2 \le \int_{B(x,2r)} \varphi^2 |\nabla u|^2 \le 4 \int_{B(x,2r)} u^2 |\nabla \varphi|^2 = \frac{4}{r^2} \int_{B(x,2r) \backslash B(x,r)} u^2.
$$
This is actually stronger than the desired inequality.