Let's suppose we have the following file:
$ cat examples.txt
grep examples
linux exam on 19th
If you try to search for word "exam":
$ grep exam examples.txt
grep examples
linux exam on 19th
both lines will be outputted.$ grep -w examples.txt
linux exam on 19th