You could setup a second branch in B which:
- can be used to merge the main branch of Bwhere those Doxygen-style comment are added (so: merge from main branch to second branch)
- but has a config activating a smudge content filter driver, with smudgebeing a script removing all Doxygen comments (that is, if those comments are easy to parse and detect)
 (image from "Customizing Git - Git Attributes", from "Pro Git book")
(image from "Customizing Git - Git Attributes", from "Pro Git book")
That involves a .gitattributes files (present only in the second branch)
*.cpp filter=removeDoxygen
(replace cpp by the right extension for your project sources)
And that involves a local config:
 git config filter.removeDoxygen.smudge 'removeDoxygen'
With removeDoxygen being a shell script anywhere in your $PATH.
(it can be a shell script even on Windows, as it will be executed by the msysgit shell)
That merge will result in files automatically modified (by the smudge script), and they will need to be added and committed in that second branch.
Then push said second branch to repo A.