It appears, based on your comment, that the output you're seeing is the contents of files that have a single character filename that match the name of the first of such files. The reason is that the
? character in your grep command is being expanded by the shell before being executed.
Thus, your ps command is doing what it should, but grep is completely ignoring that input in preference to grepping files on the command-line.
Demonstrate this for yourself by doing something like:
ps -eo 'tty,pid,comm' | grep ?
which will create an empty directory (no files in it), which will then allow the
? to fail to expand, and pass directly to grep. Then create two files like this:
echo thisisfilebwithana > b
and then re-run just the grep, like this:
and you'll see
grep saw this:
grep a b
which it interpreted as "show me all the lines from file b that contain an 'a'".
What you probably want to do instead, is escape the question mark:
ps -eo 'tty,pid,comm' | grep \?
ps -eo 'tty,pid,comm' | grep '?'