So, the gist of the paper seems to be:
1. Put all terms of the momentum and mass conservation equations of Navier Stokes on the right hand side. These should be normally identically 0.
2. Define an error term ('residual') R for each equation, this is basically the value of the RHS from step 1. The error term is 0 when pressure and velocities satisfy N-S.
3. Define the Lagrangian as the sum of residuals squared
4. Apply the Legendre transformation to the Lagrangian to get the Hamiltonian and the conjugate momenta