Perhaps the following helps:
If a tree has diameter 3 then either it is a single vertex, or there are two neighboring vertices $x,y$ such that every other vertex is a neighbor of either $x$ or $y$.
To see why this is true, consider a tree of diameter 3 with more than one vertex. If all vertices have degree 1, then the tree is of that form. Otherwise, let $x$ be a vertex of degree at least 2. If all neighbors of $x$ have degree 1, then you can designate one of them as $y$ and get the above structure. If $x$ has two different neighbors $y,z$ of degree at least 2 then the diameter is at least 4 (a neighbor $y' \neq x$ of $y$ is at distance 4 form a neighbor $z' \neq x$ of $z$), which is impossible. Therefore $x$ has a single neighbor $y$ of degree at least 2. Every vertex is thus either a neighbor of $x$ or a neighbor of $y$.