To remove all comments and empty lines from the file, you can use the following command:

grep -Ev '^\s*($|#)' file.md

If you want to diff the file with the same file without comments and empty:

diff --color -y <(grep -Ev '^\s*($|#)' file1.md) <(grep -Ev '^\s*($|#)' file2.md)