Boundary terms of formal adjoints of differential operators Let $M$ be a compact manifold with boundary. If we have two vector bundles $E, F \to M$ with inner products and a differential operator $D: C^{\infty}(E) \to C^{\infty}(F)$ then $D$ admits a formal adjoint $D^*: C^{\infty}(F) \to C^{\infty}(E)$.
This satisfies, for smooth sections with compact support in the interior $\phi \in C^{\infty}_c(E)$, $\psi \in C^{\infty}_c(F)$ the identity
$$\int_M \langle D\phi, \psi \rangle_F \text{dvol} = \int_M \langle \phi, D^*\psi \rangle_E \text{dvol}.$$
My question is, when can we understand the value of 
$$\int_M (\langle D\phi, \psi \rangle_F - \langle \phi, D^*\psi \rangle_E)\text{dvol}$$
when $\phi, \psi$ are not compactly supported in the interior? There should be some boundary term, but I can't figure out exactly what it should be.
My motivating example is the following "integration by parts" for the spin Dirac operator on the positive spinor bundle over a spin$^c$ manifold with boundary:
$$\int_M \langle D_A^+\phi, \psi \rangle = \int_M \langle \phi, D_A^-\psi \rangle - \int_{\partial M}\langle \phi, \rho(\nu)\psi \rangle.$$
Here $\rho(\nu)$ is Clifford multiplication by the unit normal vector to the boundary. 
There is a similar identity for the Levi-Civita connection, etc. 
 A: Yes, there is a generalization of such a "boundary term" for an arbitrary linear differential operator (smooth coefficients assumed, of course). My favorite way to define the formal adjoint $D^*$ of a differential operator $D$ doesn't involve any integrals. Given $D$, $D^*$ is defined by the requirement to satisfy an identity of the form
$$
  \langle D[\phi], \psi \rangle \mathrm{dvol}
  - \langle \phi, D^*[\psi] \rangle \mathrm{dvol}
  = dW[\phi,\psi] ,
$$
where $d$ is the exterior derivative, for some differential operator $W[\phi,\psi]$ that is bilinear in its arguments and is valued in $(\dim M - 1)$-forms. Such an identity is sometimes called of Green or Liouville type. If such a $D^*$ exists, then it automatically unique and (by Stokes' theorem) satisfies the adjoint formula involving integration over $M$, which you gave in the question. It is possible to go in the other direction (start from the adjoint formula with the integral and end up with the identity that I wrote), but that requires some slightly sophisticated machinery from the calculus of variations on jet bundles.
The point of the above definition is that the $W$ form is what gives you the "boundary term" that you are looking for. Namely, without the restriction of compact support (but still assuming that $M$ is compact as a manifold with boundary), you get
$$
  \int (\langle D[\phi], \psi \rangle - \langle \phi, D^*[\psi] \rangle)\mathrm{dvol}
  = \int_{\partial M} W[\phi,\psi] .
$$
Note that, by itself, $W$ is not unique, since it can equally well be replaced by $W[\phi,\psi] + dU[\phi,\psi]$. But the $dU$ term will cancel from the boundary integral, since $\partial M$ now itself has no boundary.
To actually find $W$, it is easiest to work in local coordinates, as suggested by Deane Yang. In local coordinates $(x^1,\ldots, x^n)$,
$$
  dW = d (W^a dx^1 \cdots dx^{a-1} \wedge dx^{a+1} \cdots dx^n)
  = \partial_a W^a d^nx
$$
and the key identity that you need is of course
$$
  (\partial_b f) g d^nx - f (-\partial_b g) d^nx
  = \partial_a (\delta^a_b f  g) d^nx .
$$
Heuristically, as you use integration by parts to get $D^*$ from $D$, instead of throwing away all the boundary terms, you progressively collect them in $W$.
