Capitalization and punctuation (and spelling, paragraphing, and indentation, among many other things), are not part of language at all. Certainly they're not part of grammar.
Instead, they're part of Writing -- literacy, reading, printing, wordprocessing, txting -- all of which is technological, not natural.
Language (including grammar, which is formation and arrangement of words into constituents) evolved as spoken language, for a million years or so. Humans co-evolved with spoken languages, and every normal human learns at least one spoken language long before their formal literacy training (i.e, school) starts. If it ever starts -- most humans are, and always have been, illiterate.
So the answer is: No, neither capitalization nor punctuation are part of grammar.
If English were capitalized and punctuated like German (which has quite different rules from English), it would still just be written English, and no grammatical rules would be involved. No real English grammatical rule refers to punctuation (though there are plenty of zombie rules that do).
There is another, childish, sense of grammar that leads to this question, though.
This sense of grammar is very common and means 'stuff you were sposta learn in grammar school'. Or, as is most often the case, at least in the USA, 'stuff you didn't learn in grammar school'. Since English grammar is not taught in Anglophone elementary schools, this applies to all topics of grammar and literacy, which have been mixed up for at least a century.
Best Answer
It depends on whom you ask. "Grammar", like "linguist", "weight", or "fruit", is a term that doesn't have a single perfectly defined meaning. It may have a somewhat specific meaning in certain contexts, but not in isolation.
The OED gives a longer definition (which is from 1900, so not entirely current, but I think it can be trusted to describe the usage at that point in history):
with a note including the following observations:
(As I said, the entry is from 1900, so the description of the "division now usual" is a bit out-of-date. "Accidence" as far as I know is no longer used, and seems to refer mainly to what would now be called "morphology".)
So the idea that writing has something to do with the word "grammar" is fairly old, and obviously many people continue to have this idea today—not necessarily as a scientific viewpoint, but just as part of their general way of speaking.
A number of present-day linguists (according to the meaning of that word as used by linguists, language scientists, rather than the somewhat common—and older—alternative general meaning people who know a lot of languages) object to the broadest uses of the word "grammar". See the following blog post overview by Arnold Zwicky: It’s All Grammar. Zwicky explains the reason for the objection as follows:
(link added)
It's unclear to me to what extent linguists have been successful at promoting the use of their preferred technical definition of "grammar" by lay folk, but the recency of the linked blog posts seems to indicate that many continue to use the word in ways that linguists would not prescribe.