Principles of Voice-leading
It is generally agreed that the basic vocabulary of tonal music consists of triads and seventh chords.  The grammar, so to speak, would be the way the chords are ordered (harmonic progression) and the way the individual lines connect (voice-leading), creating the harmony.

Just as a point to note, harmony deals with vertical structure while voice-leading deals with horizontal (or linear) construction.

Within melodic lines, a few basic guidelines are helpful in constructing strong, musically effective voice-leading.
1.  Move in step-wise motion or outline the underlying harmony

2.  Avoid large skips (7ths and intervals larger than an octave)
3.  When approaching a pitch by leap, leave the pitch by step in the opposite direction

4.  Avoid augmented intervals
5.  When writing diminished intervals, resolve the movement by step in the opposite direction

6.  Certain tones, referred to as active or tendency tones, usually resolve in specific ways
> leading tones tend to resolve UP to the tonic pitch
> 7ths of chords tend to resolve DOWN by step
> accidentals tend to resolve (continue) in the direction they are altered
     flats (lowered pitches) tend to resolve on DOWN by step
     sharps (raised pitches) tend to resolve on UP by step