Why this definition for "symmetry transformation"?
That is a bit of a strange definition of "symmetry transformation", since there are other kinds of transformations which are symmetries (Gauge transformations, for instance). But at least here, if you change the Lagrangian by a surface term, the action will vanish if the fields vanish at infinity. This is a standard assumption of quantum field theory. Likewise you could work on a compact manifold and force the fields to vanish at the boundary.