You can only start to earn Mission Ranks after completing a Mission once and then choosing to go through it again via the Replay Missions tab in the Sortie menu. You cannot earn a Mission Rank upon your first playthrough as part of the story — this also goes for any New Game+ playthroughs. You must beat a Mission, and then load back into it via the Replay Missions option to then go for a Mission Rank. For every Mission, you can earn as low as a D grade or as high as an S.
Unfortunately, the game doesn't make it clear what the requirements for each Mission Rank are. As such, all you can do really is try your best and hope you come out with an S. When you earn a Mission Rank, it'll be displayed on the Replay Missions menu in the Sortie.