  We consider gravity in four dimensions in the vielbein formulation, where the
fundamental variables are a tetrad $e$ and a SO(3,1) connection $\omega$. We
start with the most general action principle compatible with diffeomorphism
invariance which includes, besides the standard Palatini term, other terms that
either do not change the equations of motion, or are topological in nature. For
our analysis we employ the covariant Hamiltonian formalism where the phase
space $\Gamma$ is given by solutions to the equations of motion. We consider
spacetimes that include a boundary at infinity, satisfying asymptotically flat
boundary conditions and/or an internal boundary satisfying isolated horizons
boundary conditions. For this extended action we study the effect of the
topological terms on the Hamiltonian formulation. We prove two results. The
first one is rather generic, applicable to any field theory with boundaries:
The addition of topological terms (and any other boundary term) does not modify
the symplectic structure of the theory. The second result pertains to the
conserved Hamiltonian and Noether charges, whose properties we analyze in
detail, including their relationship. While the Hamiltonian charges are
unaffected by the addition of topological and boundary terms, we show in detail
that the Noether charges {\em do} change. Thus, a non-trivial relation between
these two sets of charges arises when the boundary and topological terms needed
for a consistent formulation are included.
