Physical properties of compact star-forming galaxies at $z\sim2-3$