  It is shown how to extend the formal variational calculus in order to
incorporate integrals of divergences into it. Such a generalization permits to
study nontrivial boundary problems in field theory on the base of canonical
formalism.
