If you read the Surrender Document and the Parole Document neither specifically protects the rebel soldiers from treason charges after the rebellion. But Grant did believe that such protections were implied and he was willing to go to the mat to protect Lee and others. It was a most honorable position to take, and Johnson eventually came around to that way of thinking when he issued his amnesty proclamations.
As Chief Justice Salmon P Chase remarked to Federal prosecutors, (paraphrased) "If you try Davis for Treason, you will lose everything in court you've won on the battlefield, for Secession isn't treason."
I'm not going to look up his exact words. You could find it if you wanted too. I expect you will now quote to me what Chase said later.