Hi
You can entrench equally in or out the city.
But there is a little defensive bonus on cities. Also, the terrain is restricted and a little force inside the city can only be attacked by a big enemy with only some of his forces at a time. An advantage to the defender.
The BIG problem is that inside the city you are vulnerable to siege or surrender of all your forces if you lose the battle.
Outside the city, the remaining of your defeated troops will withdraw to another area and live to fight another day.
AACW experts like runyan advise to always defend outside (ckeck his great strategy tips about this matter here)
http://www.ageod-forum.com/showthread.php?t=6823
I (not an AACW expert at all…

) prefer to keep very small forces (garrison of militia or small brigades) inside, but place bigger forces outside so they can retreat.
Cheers!