grep(1) man page:
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
Thus you'll need to explicitly request the spaces (or line beginnings and/or ends) to be there:
grep -E '(^| )ABC( |$)' file1
If you also want to include other white-space characters, replace the spaces above with a larger set, e.g.
[[:space:]] (again see the
grep(1) man page).