The grammar of each TeX command is more or less completely given in The TeXBook. Note, however, that unlike most programming languages the lexical analysis and tokenisation of the input cannot be separated from execution as the catcode table which controls tokenisation is dynamically changeable. Thus parsing TeX tends to defeat most parser generation tools.
LaTeX is a set of macros written in TeX so is defined by its implementation, although there is fairly extensive documentation in The LaTeX Companion, the LaTeX book (LaTeX: A Document Preparation System), and elsewhere.
Packages are not really plugin-like which usually implies some sort of binary API. They are (mostly) source level inclusion of macro definitions so more like #include (if you know the C pre-processor macro system) than anything else.
tex, with extensive documentation to say the least, is available via the shell commandtexdoc tex. – Sean Allred Dec 23 '13 at 02:01:)– Paulo Cereda Dec 23 '13 at 13:20