We consider a Backward Stochastic Differential Equation (BSDE for short) in a Markovian framework for the pair of processes $(Y,Z)$, with generator with quadratic growth with respect to $Z$. The forward equation is an evolution equation in an abstract Banach space. We prove an analogue of the Bismut-Elworty formula when the diffusion operator has a pseudo-inverse not necessarily bounded and when the generator has quadratic growth with respect to $Z$. In particular, our model covers the case of the heat equation in space dimension greater than or equal to 2. We apply these results to solve semilinear Kolmogorov equations for the unknown $v$, with nonlinear term with quadratic growth with respect to $\nabla v$ and final condition only bounded and continuous, and to solve stochastic optimal control problems with quadratic growth.