They differ by the base.
Imagine that you drew a triangle and a rectangle on a piece of paper.
Then, pick a point above the paper, and connect all vertices of the triangle with that point. That is a triangular pyramid.
Similarly, pick a point above the rectangle, and connect each vertex of the rectangle with that point. That is a rectangular pyramid.